<%@ page language="java" import="java.util.*" pageEncoding="utf-8"
	isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    String path = request.getContextPath();
			String basePath = request.getScheme() + "://"
					+ request.getServerName() + ":" + request.getServerPort()
					+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/easyui/jquery.min.js"></script>
<link href="<%=request.getContextPath()%>/css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/umeditor/themes/default/css/umeditor.css">
<script src="<%=request.getContextPath()%>/js/laydate/jquery-3.2.1.min.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/jPages.css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/animate.css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/bootstrap.min.css">
<script src="<%=request.getContextPath()%>/js/jPages.js"></script>
<script src="<%=request.getContextPath()%>/js/liandong.js"></script>
</head>

<body>
	<div class="place" style="margin-top:-11px;">
		<span>位置：</span>
		<ul class="placeul">
			<li><ema href="javascript:void">首页</em></li>
			<li><ema href="javascript:void">技能管理</em></li>
			<li><ema href="javascript:void">编辑服务</em></li>
		</ul>
	</div></br></br>
	<ul class="forminfo">
	<c:forEach items="${lists}" var="data">
	 <li><label>分类昵称</label>
		    <select class="dfinput" style="width:300px;" id="server_name" >
				<option>${data.server_name}</option>
				<option>劳务</option>
				<option>陪护</option>
				<option>咨询</option>
			</select>
	    </li>
     <li><label>子分类昵称</label>
     <input name="sub_name" class="dfinput" value="${data.server_sub_name}" style="width:300px;resize:none;"></input>
     <input type="hidden" value="${data.id}"/>
     </li>
     <li><label>服务价格</label><input name="price" class="dfinput" value="${data.server_price}" style="width:300px;resize:none;"></input></li>
     <li><label>服务内容</label><textarea name="detailed" class="dfinput" style="width:800px;height:90px;resize:none;">${data.detailed}</textarea></li>
  	</c:forEach>
    </ul>
    <div style="margin:25px;padding-left:400px;"><input name="" type="button" class="tijiao" value="提交" style="width:96px; height:35px; line-height:35px; color:#fff; background:red; font-size:14px; font-weight:bold;border-radius: 3px; cursor:pointer;"/>
    &nbsp;<input name="" type="button" class="cancel" value="取消" /></div>
   	<div class="tip">
		<div class="tiptop">
			<span>提示信息</span>
		</div>
		<div class="tipinfo">
			<span><img src="<%=request.getContextPath()%>/images/ticon.png" /></span>
			<div class="tipright">
				<p>添加成功!</p>
				<cite>点击确定返回服务列表。</cite>
			</div>
		</div>
		<div class="tipbtn">
			<input name="" type="button" class="sure" value="确定"/>&nbsp;<input name="" type="button" class="cancel" value="取消" />
		</div>
	</div>
    <script type="text/javascript">
    	$(function(){
    		$(".tijiao").click(function(){
    			var server_name = $("#server_name").find("option:selected").text();
    			if(server_name == "请选择"){
   					alert("请选择分类昵称");
   					return;
   				}
    			var sub_name = $("input[name=sub_name]").val();
    			if(sub_name == null || sub_name == ''){
    				alert("请填写子分类昵称");
    				return;
    			}
    			var price = $("input[name=price]").val();
    			if(price == null || price == ''){
    				alert("请填写服务价格");
    				return;
    			}
    			if(isNaN(price)){
	      	    	 alert("服务价格只能为数字");$("input[name=price]").val("");return;
	      	    }
    			var detailed = $("textarea[name=detailed]").val();
    			if(detailed == null || detailed == ''){
    				alert("请填写服务内容");
    			}
   	    		$.ajax({
   	   				type:"get",
   	   				url:"/htx-backer/updateServer", 
   	   				data:{
   	   					id:$("input[type=hidden]").val(),
   	   					server_name:server_name,
   	   					server_sub_name:sub_name,
   	   					server_price:price,
   	   					detailed:detailed,
   	   				},
   	   				dataType:"json",
   	   				success:function(data){
   	   					var flag = data.flag;
   	   					if(flag == 1){
   	   						var con = confirm("修改成功，点击确定返回服务列表");
   	   						if(con){
   	   							window.location.href="/htx-backer/skillList";	
   	   						}
   	   					}
   	   				}
   				})
    		})
    		$(".cancel").click(function(){
   				window.location.href="/htx-backer/skillList";
   			})
    	})
    </script>
</body>
</html>
